﻿using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Dukey.DBUtility;
using System.Text;

public partial class Crm_Left :BaseCrm
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable dt = BLL.DataBaseHelper.instance.GetList("crm_menus", "", 0, "", " menuid").Tables[0];   
            DataTable mytable = dt.Copy();
            DataView dv = dt.DefaultView;

            dv.RowFilter = "ParentId is null ";        
            
            foreach (DataRowView drv in dv)
            {
                DataView dv1 = mytable.DefaultView;
                dv1.RowFilter = "ParentId='" + drv["MenuId"].ToString()+"'";
                StringBuilder str=new StringBuilder();
                foreach (DataRowView dr in dv1)
                {
                    str.Append(string.Format("<tr height=\"20\"><td><a href=\"{1}\" target=\"right\">{0}</a></td></tr>",dr["MenuName"].ToString(),dr["Path"].ToString()));
                }
                litertree.Text += string.Format(liter.Text, drv["MenuName"].ToString(), str.ToString(),drv["MenuId"].ToString());
            }

        }
    }
}
